#region (c) 2014 THN Solutions LLC. - All rights reserved
/*
THN DATA ABSTRACTION LAYER version 1

Copyright (c) 2014, THN Solutions LLC. ( www.ThnSolutions.com )
Author: Nguyễn, M. Hải                 ( www.Minh-Hai.com     )
All rights reserved.

This library is dual-licensed.
  + For commercial software, please obtain a commercial license from THN Solutions LLC.

  + For free software, this library is licensed under GPL version 3. A summary of GPLv3 is
    listed below. You should also find a copy of GPLv3 as file License_GPLv3.txt included
	with the source-code files.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License version 3 as published by
    the Free Software Foundation  of the License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#endregion

#region Using directives
using System;
using Thn.Application.Language;
#endregion

namespace Thn.Data.Exceptions
{
    /// <summary>
    /// Data tier exceptions translator for Vietnamese language
    /// </summary>
    public class VietnameseTranslator : ITranslator
    {
        #region GroupID
        /// <summary>
        /// ID of text group this translator can translate
        /// </summary>
        public string GroupID
        {
            get { return DataExceptionConstants.GroupID; }
        }
        #endregion

        #region Supported Dialect
        /// <summary>
        /// Gets the dialect this translator supports
        /// </summary>
        public string SupportedDialect
        {
            get { return "Vietnamese"; }
        }
        #endregion

        #region Translate
        /// <summary>
        /// Translate a data tier exception based on its ID
        /// </summary>
        public string Translate(string message, params object[] parameters)
        {
            string result = "";

            if (message == DataExceptionConstants.CanNotOpenConnection)
                result = "Không kết nối được tới cơ sở dữ liệu";
            else if (message == DataExceptionConstants.TypeNotSupported)
                result = string.Format("SQL dialect hiện tại không hỗ trợ thuộc tính kiểu [{0}]", parameters[0]);
            else if (message == DataExceptionConstants.NoIdentifier)
                result = string.Format("Vui lòng chỉ rõ ít nhất một identifier cho đối tượng kiểu {0}", parameters[0]);

            else if (message == DataExceptionConstants.NoValueInQuery)
                result = string.Format("Query không có dữ liệu để thực thi");
            else if (message == DataExceptionConstants.AttributeNotFound)
                result = string.Format("Đối tượng kiểu {0} không có thuộc tính [{1}]", parameters[0], parameters[1]);
            else if (message == DataExceptionConstants.NothingToDelete)
                result = "Query dùng để xóa phải có ít nhất 1 giá trị hoặc From phải được chỉ định";
            else if (message == DataExceptionConstants.EntityNotSpecified)
                result = "Chưa chỉ định kiểu đối tượng. Hãy sử dụng From để chỉ định";

            else if (message == DataExceptionConstants.NoParentTransaction)
                result = "Query này không có transaction cha để bắt đầu một transaction con mới";

            return result;
        }
        #endregion
    }
}
